﻿using Rename.UC;
using System.Windows.Forms;
using Rename.UC.组合;

namespace Rename
{
    partial class frmMain
    {
        /// <summary>
        /// LinkLable按钮状态
        /// </summary>
        /// <param name="ucLink">当前选中按钮</param>
        /// <param name="content">返回内容</param>
        private void LinkLabelSelectState(UcLinkLabel ucLink, string content)
        {
            ////上方按钮变化
            switch (ucLink.Text)
            {
                case "图片重命名":
                case "文件重命名":
                case "文件夹重命名":ucBtn开始命名.Text = "开始命名"; break;
                case "文件时间属性":
                case "文件夹时间属性": ucBtn开始命名.Text = "开始修改"; break;
                case "提取文件名称":
                case "提取文件夹名称": ucBtn开始命名.Text = "开始提取"; break;
                case "批量新建文件夹": ucBtn开始命名.Text = "开始生成"; break;
                default:break;
            }
            ////////左侧边LinkLabel按钮变化/////////////////////////////////
            foreach (Control item in panLeft.Controls)
            {
                UcLinkLabel ucLinkItem = item as UcLinkLabel;
                if (ucLinkItem == null) continue;
                string name = ucLinkItem.Name;
                if (name.Contains(ucLink.Text) == true)
                {
                    ucLinkItem.IsClicked = true;
                    ucLinkItem.SetMouseEnterIcon();
                }
                else
                {
                    ucLinkItem.IsClicked = false;
                    ucLinkItem.SetMouseLeaveIcon();
                }
            }
            //////文件列表面板变化/////////////////////////////////////////////////////
            foreach (Control ucMainItem in panBottom.Controls)
            {
                Uc中间主界面 ucMain = ucMainItem as Uc中间主界面;

                if (ucMain == null) continue;
                string name = ucMain.Name;           
                if (name.Contains(ucLink.Text))
                {
                    _currentUc中间主界面 = ucMain;
                    lbl文件数量.Text = _currentUc中间主界面.Uc中间列表.UcFastOLSV.RowsCount.ToString();
                    _currentUc中间主界面.Uc中间列表.UcFastOLSV.RowsCountChange -= UcFastOLSV_RowsCountChange;
                    _currentUc中间主界面.Uc中间列表.UcFastOLSV.RowsCountChange += UcFastOLSV_RowsCountChange;
                    ucMain.Visible = true;
                    ucMain.Dock = DockStyle.Fill;
                    ucMain.UcButton添加拖拽文件.SetBakcgroundImageAndText(ucLink.Text, content);
                }
                else
                {
                    ucMain.Visible = false;
                    ucMain.Dock = DockStyle.None;
                }
            }
        }
    }
}
